package com.appwoo.txtws.adapter;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.appwoo.txtws.activity.WinInTestBookActivity;
import com.appwoo.txtws.bean.BookSubjectBean;
import java.util.ArrayList;

public class WinInTestAdapter extends BaseAdapter
{
  private ArrayList<BookSubjectBean> bookSubjects;
  private Context context;
  private int grade;
  private int height;
  private LayoutInflater inflater;
  private View.OnClickListener layoutOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      WinInTestAdapter.ViewHolderWinInTest localViewHolderWinInTest = (WinInTestAdapter.ViewHolderWinInTest)paramAnonymousView.getTag();
      Intent localIntent = new Intent(WinInTestAdapter.this.context, WinInTestBookActivity.class);
      localIntent.putExtra("subject", localViewHolderWinInTest.bookSubject.getName());
      localIntent.putExtra("grade", WinInTestAdapter.this.grade);
      WinInTestAdapter.this.context.startActivity(localIntent);
    }
  };
  private int width;

  public WinInTestAdapter(Context paramContext, ArrayList<BookSubjectBean> paramArrayList, int paramInt)
  {
    this.context = paramContext;
    this.bookSubjects = paramArrayList;
    this.width = paramInt;
    this.height = ((int)(72.0F * (paramInt / 60.0F)));
    this.inflater = ((LayoutInflater)this.context.getSystemService("layout_inflater"));
  }

  public int getCount()
  {
    return this.bookSubjects.size();
  }

  public Object getItem(int paramInt)
  {
    return this.bookSubjects.get(paramInt);
  }

  public long getItemId(int paramInt)
  {
    return ((BookSubjectBean)this.bookSubjects.get(paramInt)).getSubjectId();
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    ViewHolderWinInTest localViewHolderWinInTest;
    if (paramView == null)
    {
      localViewHolderWinInTest = new ViewHolderWinInTest();
      paramView = this.inflater.inflate(2130903238, null);
      localViewHolderWinInTest.ivSubject = ((ImageView)paramView.findViewById(2131493667));
      localViewHolderWinInTest.tvSubject = ((TextView)paramView.findViewById(2131493668));
      localViewHolderWinInTest.ivSubject.setLayoutParams(new LinearLayout.LayoutParams(this.width, this.height));
      paramView.setTag(localViewHolderWinInTest);
    }
    while (true)
    {
      paramView.setOnClickListener(this.layoutOnClickListener);
      localViewHolderWinInTest.bookSubject = ((BookSubjectBean)this.bookSubjects.get(paramInt));
      localViewHolderWinInTest.ivSubject.setBackgroundDrawable(this.context.getResources().getDrawable(this.context.getResources().getIdentifier(localViewHolderWinInTest.bookSubject.getDrawable(), "drawable", this.context.getPackageName())));
      localViewHolderWinInTest.tvSubject.setText(localViewHolderWinInTest.bookSubject.getName());
      return paramView;
      localViewHolderWinInTest = (ViewHolderWinInTest)paramView.getTag();
    }
  }

  public void setBookGrade(int paramInt)
  {
    this.grade = paramInt;
  }

  public void setData(ArrayList<BookSubjectBean> paramArrayList)
  {
    this.bookSubjects = paramArrayList;
  }

  class ViewHolderWinInTest
  {
    BookSubjectBean bookSubject;
    ImageView ivSubject;
    TextView tvSubject;

    ViewHolderWinInTest()
    {
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.adapter.WinInTestAdapter
 * JD-Core Version:    0.6.2
 */